#include "stdafx.h"
#include "Town.h"

#include "../db/Town.h"

#ifdef WIN32
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif //_DEBUG
#endif //WIND32

namespace serika
{
	namespace dq
	{
		Town::Town(db::Town* town, TransientState::Enum state)
		{
			mDb = new Db(town, state);
		}

		Town::~Town()
		{
			delete mDb;
		}

		// static 
		Town* Town::FromDb(db::Town* town)
		{
			return new Town(town, TransientState::Clean);
		}

		int Town::GetId() const
		{
			return mDb->GetInt("id");
		}

		const ut::String& Town::GetChinessName() const
		{
			return mDb->GetString("chiness_name");
		}

		const ut::String& Town::GetJapanessName() const
		{
			return mDb->GetString("japaness_name");
		}

		const ut::String& Town::GetSellItems() const
		{
			return mDb->GetString("sell_items");
		}
	}
}
